import { createRouter, createWebHistory } from 'vue-router';
import Inbox from '../views/Inbox.vue';
import Sent from '../views/Sent.vue';
import Drafts from '../views/Drafts.vue';
import Trash from '../views/Trash.vue';
import Compose from '../views/Compose.vue';
import Login from "../views/Login.vue"
import Layout from "../layouts/Layout.vue"
import Agreement from "../views/agreement_wap.vue"
import AgreementDoc from "../views/agreement_doc.vue"

const routes = [
  {
     path:"/",
     redirect:"/inbox",
     component:Layout,
     children:[
      {
        path: 'inbox',
        component: Inbox,
        name: 'Inbox',
        meta: { requiresAuth: true } // 添加需要认证的元信息
      },
      {
        path: 'sent',
        component: Sent,
        name: 'Sent',
        meta: { requiresAuth: true } // 添加需要认证的元信息
      },
      {
        path: 'drafts',
        component: Drafts,
        name: 'Drafts',
        meta: { requiresAuth: true } // 添加需要认证的元信息
      },
      {
        path: 'trash',
        component: Trash,
        name: 'Trash',
        meta: { requiresAuth: true } // 添加需要认证的元信息
      },
      {
        path: 'compose',
        component: Compose,
        name: 'Compose',
        meta: { requiresAuth: true } // 添加需要认证的元信息
      },
     ]
  },
  // { path: '/', redirect: '/inbox' },
  // { path: '/inbox', component: Inbox },
  // { path: '/sent', component: Sent },
  // { path: '/drafts', component: Drafts },
  // { path: '/trash', component: Trash },
  // { path: '/compose', component: Compose },
  {
    path: '/login',
    component: Login,
    name: 'Login',
    meta: { requiresAuth: false } // 登录页不需要认证
  },
  {
    path: '/agreement',
    component: Agreement,
    name: 'agreement',
    meta: { requiresAuth: false } // 登录页不需要认证
  },
  {
    path: '/agreementDoc',
    component: AgreementDoc,
    name: 'AgreementDoc',
    meta: { requiresAuth: false } // 登录页不需要认证
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;